home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-22 | 11.3 KB | 416 lines | [TEXT/MPS ] |
- {
- File: Drag.p
-
- Contains: Pascal Interface to Drag Manager
-
- Copyright: © 1992-1994 by Apple Computer, Inc., all rights reserved.
-
- }
-
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT Drag;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED UsingDrag}
- {$SETC UsingDrag := 1}
-
- {$I+}
- {$SETC DragIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
- {$IFC UNDEFINED UsingAppleEvents}
- {$I $$Shell(PInterfaces)AppleEvents.p}
- {$ENDC}
- {$IFC UNDEFINED UsingTextEdit}
- {$I $$Shell(PInterfaces)TextEdit.p}
- {$ENDC}
- {$SETC UsingIncludes := DragIncludes}
-
-
-
- { Gestalt Selector and Response Constants (will move to GestaltEqu.p) }
-
- CONST
- gestaltDragMgrAttr = 'drag'; { Drag Manager attributes }
- gestaltDragMgrPresent = 0; { Drag Manager is present }
- gestaltDragMgrFloatingWind = 1; { Drag Manager supports floating windows }
- gestaltPPCDragLibPresent = 2; { Drag Manager PPC DragLib is present }
-
- gestaltTEAttr = 'teat'; { TextEdit attributes }
- gestaltTEHasGetHiliteRgn = 0; { TextEdit has TEGetHiliteRgn }
-
-
- { Flavor Flags }
-
- CONST
- flavorSenderOnly = $00000001; { flavor is available to sender only }
- flavorSenderTranslated = $00000002; { flavor is translated by sender }
- flavorNotSaved = $00000004; { flavor should not be saved }
- flavorSystemTranslated = $00000100; { flavor is translated by system }
-
- TYPE
- FlavorFlags = LONGINT;
-
-
- { Drag Attributes }
-
- CONST
- dragHasLeftSenderWindow = $00000001; { drag has left the source window since TrackDrag }
- dragInsideSenderApplication = $00000002; { drag is occurring within the source application }
- dragInsideSenderWindow = $00000004; { drag is occurring within the source window }
-
- TYPE
- DragAttributes = LONGINT;
-
-
- { Special Flavor Types }
-
- CONST
- flavorTypeHFS = 'hfs '; { flavor type for HFS data }
- flavorTypePromiseHFS = 'phfs'; { flavor type for promised HFS data }
- flavorTypeDirectory = 'diry'; { flavor type for AOCE directory }
-
-
- { Drag Tracking Handler Messages }
-
- CONST
- dragTrackingEnterHandler = 1; { drag has entered handler }
- dragTrackingEnterWindow = 2; { drag has entered window }
- dragTrackingInWindow = 3; { drag is moving within window }
- dragTrackingLeaveWindow = 4; { drag has exited window }
- dragTrackingLeaveHandler = 5; { drag has exited handler }
-
- TYPE
- DragTrackingMessage = INTEGER;
-
-
- { Drag Drawing Procedure Messages }
-
- CONST
- dragRegionBegin = 1; { initialize drawing }
- dragRegionDraw = 2; { draw drag feedback }
- dragRegionHide = 3; { hide drag feedback }
- dragRegionIdle = 4; { drag feedback idle time }
- dragRegionEnd = 5; { end of drawing }
-
- TYPE
- DragRegionMessage = INTEGER;
-
-
- { Zoom Acceleration }
-
- CONST
- zoomNoAcceleration = 0; { use linear interpolation }
- zoomAccelerate = 1; { ramp up step size }
- zoomDecelerate = 2; { ramp down step size }
-
- TYPE
- ZoomAcceleration = INTEGER;
-
-
- { Drag Manager Data Types }
-
- TYPE
- DragReference = LONGINT;
- ItemReference = LONGINT;
-
- FlavorType = ResType;
-
-
- { Result Codes - (will move to Errors.p) }
-
- CONST
- badDragRefErr = -1850; { unknown drag reference }
- badDragItemErr = -1851; { unknown drag item reference }
- badDragFlavorErr = -1852; { unknown flavor type }
- duplicateFlavorErr = -1853; { flavor type already exists }
- cantGetFlavorErr = -1854; { error while trying to get flavor data }
- duplicateHandlerErr = -1855; { handler already exists }
- handlerNotFoundErr = -1856; { handler not found }
- dragNotAcceptedErr = -1857; { drag was not accepted by receiver }
-
-
- { HFS Flavor }
-
- TYPE
- HFSFlavor = RECORD
- fileType: OSType; { file type }
- fileCreator: OSType; { file creator }
- fdFlags: INTEGER; { Finder flags }
- fileSpec: FSSpec; { file system specification }
- END;
-
-
- { Promise HFS Flavor }
-
- TYPE
- PromiseHFSFlavor = RECORD
- fileType: OSType; { file type }
- fileCreator: OSType; { file creator }
- fdFlags: INTEGER; { Finder flags }
- promisedFlavor: FlavorType; { promised flavor containing FSSpec }
- END;
-
-
- { Application-Defined Drag Handler Routines }
-
- TYPE
- DragTrackingHandler = ProcPtr; { FUNCTION TrackingHandler (message : DragTrackingMessage,
- theWindow : WindowPtr,
- handlerRefCon : Ptr,
- theDragRef : DragReference) : OSErr; }
- DragReceiveHandler = ProcPtr; { FUNCTION ReceiveHandler (theWindow : WindowPtr,
- handlerRefCon : Ptr,
- theDragRef : DragReference) : OSErr; }
-
-
- { Application-Defined Routines }
-
- TYPE
- DragSendDataProc = ProcPtr; { FUNCTION SendDataProc (theType : FlavorType,
- dragSendRefCon : Ptr,
- theItemRef : ItemReference,
- theDragRef : DragReference) : OSErr; }
- DragInputProc = ProcPtr; { FUNCTION InputProc (VAR mouse : Point,
- VAR modifiers : INTEGER,
- dragInputRefCon : Ptr,
- theDragRef : DragReference) : OSErr; }
- DragDrawingProc = ProcPtr; { FUNCTION DrawingProc (message : DragRegionMessage,
- showRegion : RgnHandle,
- showOrigin : Point,
- hideRegion : RgnHandle,
- hideOrigin : Point,
- dragDrawingRefCon : Ptr,
- theDragRef : DragReference) : OSErr; }
-
-
- { Drag Manager Routines }
-
-
- { Installing and Removing Drag Handlers }
-
- FUNCTION InstallTrackingHandler (trackingHandler : DragTrackingHandler;
- theWindow : WindowPtr;
- handlerRefCon : UNIV Ptr) : OSErr;
- INLINE $7001, $ABED;
-
- FUNCTION InstallReceiveHandler (receiveHandler : DragReceiveHandler;
- theWindow : WindowPtr;
- handlerRefCon : UNIV Ptr) : OSErr;
- INLINE $7002, $ABED;
-
- FUNCTION RemoveTrackingHandler (trackingHandler : DragTrackingHandler;
- theWindow : WindowPtr) : OSErr;
- INLINE $7003, $ABED;
-
- FUNCTION RemoveReceiveHandler (receiveHandler : DragReceiveHandler;
- theWindow : WindowPtr) : OSErr;
- INLINE $7004, $ABED;
-
-
- { Creating and Disposing Drag References }
-
- FUNCTION NewDrag (VAR theDragRef : DragReference) : OSErr;
- INLINE $7005, $ABED;
-
- FUNCTION DisposeDrag (theDragRef : DragReference) : OSErr;
- INLINE $7006, $ABED;
-
-
- { Adding Drag Item Flavors }
-
- FUNCTION AddDragItemFlavor (theDragRef : DragReference;
- theItemRef : ItemReference;
- theType : FlavorType;
- dataPtr : UNIV Ptr;
- dataSize : Size;
- theFlags : FlavorFlags) : OSErr;
- INLINE $7007, $ABED;
-
- FUNCTION AddHFSFlavor (theDragRef : DragReference;
- theItemRef : ItemReference;
- fileSpec : FSSpec;
- theFlags : FlavorFlags) : OSErr;
- INLINE $7008, $ABED;
-
- FUNCTION SetDragItemFlavorData (theDragRef : DragReference;
- theItemRef : ItemReference;
- theType : FlavorType;
- dataPtr : UNIV Ptr;
- dataSize : Size;
- dataOffset : LONGINT) : OSErr;
- INLINE $7009, $ABED;
-
-
- { Providing Drag Callback Procedures }
-
- FUNCTION SetDragSendProc (theDragRef : DragReference;
- sendProc : DragSendDataProc;
- dragSendRefCon : UNIV Ptr) : OSErr;
- INLINE $700A, $ABED;
-
- FUNCTION SetDragInputProc (theDragRef : DragReference;
- inputProc : DragInputProc;
- dragInputRefCon : UNIV Ptr) : OSErr;
- INLINE $700B, $ABED;
-
- FUNCTION SetDragDrawingProc (theDragRef : DragReference;
- drawingProc : DragDrawingProc;
- dragDrawingRefCon : UNIV Ptr) : OSErr;
- INLINE $700C, $ABED;
-
-
- { Performing a Drag }
-
- FUNCTION TrackDrag (theDragRef : DragReference;
- theEvent : EventRecord;
- theRegion : RgnHandle) : OSErr;
- INLINE $700D, $ABED;
-
-
- { Getting Drag Item Information }
-
- FUNCTION CountDragItems (theDragRef : DragReference;
- VAR numItems : INTEGER) : OSErr;
- INLINE $700E, $ABED;
-
- FUNCTION GetDragItemReferenceNumber
- (theDragRef : DragReference;
- index : INTEGER;
- VAR theItemRef : ItemReference) : OSErr;
- INLINE $700F, $ABED;
-
- FUNCTION CountDragItemFlavors (theDragRef : DragReference;
- theItemRef : ItemReference;
- VAR numFlavors : INTEGER) : OSErr;
- INLINE $7010, $ABED;
-
- FUNCTION GetFlavorType (theDragRef : DragReference;
- theItemRef : ItemReference;
- index : INTEGER;
- VAR theType : FlavorType) : OSErr;
- INLINE $7011, $ABED;
-
- FUNCTION GetFlavorFlags (theDragRef : DragReference;
- theItemRef : ItemReference;
- theType : FlavorType;
- VAR theFlags : FlavorFlags) : OSErr;
- INLINE $7012, $ABED;
-
- FUNCTION GetFlavorDataSize (theDragRef : DragReference;
- theItemRef : ItemReference;
- theType : FlavorType;
- VAR dataSize : Size) : OSErr;
- INLINE $7013, $ABED;
-
- FUNCTION GetFlavorData (theDragRef : DragReference;
- theItemRef : ItemReference;
- theType : FlavorType;
- dataPtr : UNIV Ptr;
- VAR dataSize : Size;
- dataOffset : LONGINT) : OSErr;
- INLINE $7014, $ABED;
-
- FUNCTION GetDragItemBounds (theDragRef : DragReference;
- theItemRef : ItemReference;
- VAR itemBounds : Rect) : OSErr;
- INLINE $7015, $ABED;
-
- FUNCTION SetDragItemBounds (theDragRef : DragReference;
- theItemRef : ItemReference;
- itemBounds : Rect) : OSErr;
- INLINE $7016, $ABED;
-
- FUNCTION GetDropLocation (theDragRef : DragReference;
- VAR dropLocation : AEDesc) : OSErr;
- INLINE $7017, $ABED;
-
- FUNCTION SetDropLocation (theDragRef : DragReference;
- dropLocation : AEDesc) : OSErr;
- INLINE $7018, $ABED;
-
-
-
- { Getting Information About a Drag }
-
- FUNCTION GetDragAttributes (theDragRef : DragReference;
- VAR flags : DragAttributes) : OSErr;
- INLINE $7019, $ABED;
-
- FUNCTION GetDragMouse (theDragRef : DragReference;
- VAR mouse : Point;
- VAR pinnedMouse : Point) : OSErr;
- INLINE $701A, $ABED;
-
- FUNCTION SetDragMouse (theDragRef : DragReference;
- pinnedMouse : Point) : OSErr;
- INLINE $701B, $ABED;
-
- FUNCTION GetDragOrigin (theDragRef : DragReference;
- VAR initialMouse : Point) : OSErr;
- INLINE $701C, $ABED;
-
- FUNCTION GetDragModifiers (theDragRef : DragReference;
- VAR modifiers : INTEGER;
- VAR mouseDownModifiers : INTEGER;
- VAR mouseUpModifiers : INTEGER) : OSErr;
- INLINE $701D, $ABED;
-
-
- { Drag Highlighting }
-
- FUNCTION ShowDragHilite (theDragRef : DragReference;
- hiliteFrame : RgnHandle;
- inside : Boolean) : OSErr;
- INLINE $701E, $ABED;
-
- FUNCTION HideDragHilite (theDragRef : DragReference) : OSErr;
- INLINE $701F, $ABED;
-
- FUNCTION DragPreScroll (theDragRef : DragReference;
- dH : INTEGER;
- dV : INTEGER) : OSErr;
- INLINE $7020, $ABED;
-
- FUNCTION DragPostScroll (theDragRef : DragReference) : OSErr;
- INLINE $7021, $ABED;
-
- FUNCTION UpdateDragHilite (theDragRef : DragReference;
- updateRgn : RgnHandle) : OSErr;
- INLINE $7022, $ABED;
-
-
- { Drag Manager Utilities }
-
- FUNCTION WaitMouseMoved (initialMouse : Point) : BOOLEAN;
- INLINE $7023, $ABED;
-
- FUNCTION ZoomRects (fromRect : Rect;
- toRect : Rect;
- zoomSteps : INTEGER;
- acceleration : ZoomAcceleration) : OSErr;
- INLINE $7024, $ABED;
-
- FUNCTION ZoomRegion (region : RgnHandle;
- zoomDistance : Point;
- zoomSteps : INTEGER;
- acceleration : ZoomAcceleration) : OSErr;
- INLINE $7025, $ABED;
-
-
- { Will move to TextEdit.p }
- FUNCTION TEGetHiliteRgn (region : RgnHandle;
- hTE : TEHandle) : OSErr;
- INLINE $3F3C, $000F, $A83D;
-
-
- {$ENDC} { UsingDrag }
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-